package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
    //1. 插入微博
    //@Insert("insert into weibo(content,created,user_id) values(#{content},#{created},#{userId})")
    int insertWeibo(Weibo weibo);

    //2. 删除指定微博
    //@Delete("delete from weibo where id=#{id}")
    int deleteWeibo(Long id);

    //3. 修改指定微博信息
    //@Update("update weibo set content=#{content},created=#{created},user_id=#{userId} where id=#{id}")
    int updateWeibo(Weibo weibo);

    //4.查询:单条数据全字段查询[根据ID查询某条微博的所有信息]
    //@Select("select id,content,created,user_id userId from weibo where id=#{id}")
    Weibo selectWeiboById(Long id);

    //5.查询: 多条数据全字段查询[查询所有的微博信息]
    //@Select("select id,content,created,user_id userId from weibo")
    List<Weibo> selectWeibo();

    //6.单条数据部分字段查询：查询指定微博的内容和发布时间
    //@Select("select content,created from weibo where id=#{id}")
    SelectWeiboVO1 selectWeiboVO1(Long id);

    //7.多条数据部分字段查询：查询指定用户发的所有微博的id和内容content
    //@Select("select id,content from weibo where user_Id=#{userId}")
    List<SelectWeiboVO2> selectWeiboVO2(Long userId);

    //8
    int dynamicUpdateWeibo(Weibo weibo);

    //9
    int dynamicDeleteWeibo1(Long[] ids);

    //10
    int dynamicDeleteWeibo2(List<Long> ids);

    //11
    int selectCount();

    //12
    ResultMapVO1 selectResultMapVO1(Long id);

    //13
    ResultMapVO2 selectResultMapVO2(Long id);

    //14
    ResultMapVO3 selectResultMapVO3(Long weiboId);

    //15
    ResultMapVO4 selectResultMapVO4(Long weiboId);
}
